{% extends '::backend.html.twig' %}
{% block id 'oficina' %}
{% block contenido %}
{% block documentReadyJavascript %} 
    {{ parent() }}
    <script type="text/javascript" >
        $(".delete").on('click', function(e){
                e.preventDefault()
                $this = $(this);
                $("#confirmation-dialog").dialog({
                resizable: false,
                height:180,
                width:'auto',
                modal: true,
                title:"Alerta!",
                buttons: {
                    "Eliminar": function() {
                        $this.parent().submit();
                    },
                    Cancelar: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        });
    </script>
{% endblock documentReadyJavascript %}
    <legend>Datos del Usuario</div></legend>
<fieldset> 
    <div class="well well-small"><div class="span5"><strong>Usuario:</strong></div><div class="span6"><strong>{{ entity.username }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>Roles:</strong></div>
        <div class="span6">
            <strong>
                {% for rol in roles %}
                    {{ rol.name }} 
                    {% if not loop.last %}
                        -
                    {% endif %}
                {% endfor %}    
            </strong>
        </div>
    </div>
    <div class="well well-small"><div class="span5"><strong>Oficina:</strong></div><div class="span6"><strong>{{ entity.oficina }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>Apellido:</strong></div><div class="span6"><strong>{{ entity.apellido }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>Nombre:</strong></div><div class="span6"><strong>{{ entity.nombre }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>D.N.I.:</strong></div><div class="span6"><strong>{{ entity.dni }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>Tel&eacute;fono:</strong></div><div class="span6"><strong>{{ entity.telefono }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>E-mail:</strong></div><div class="span6"><strong>{{ entity.email }}</strong></div></div>
    <div class="well well-small"><div class="span5"><strong>Direcci&oacute;n:</strong></div><div class="span6"><strong>{{ entity.direccion }}</strong></div></div>    
    <div class="well well-small"><div class="span5"><strong>C&oacute;digo Postal:</strong></div><div class="span6"><strong>{{ entity.codigopostal }}</strong></div></div>
    <div class="form-actions">
        {% set esEditor = (is_granted("ROLE_ADMIN") or is_granted("ROLE_SUPER_ADMIN")) %}
        {% include 'BackendBundle:Default:accionesConPermisos.html.twig' with {'basePath':'user','esEditor':(esEditor)}%}
        <a class="btn btn-primary  btn-small" href="{{ path('user') }}">
            <i class="icon-arrow-left"></i> Volver
        </a>
    </div>    
</fieldset>
<div id="confirmation-dialog" style="display:none">
    <div class="alert alert-error">
        <strong>Borrara!</strong>  el usuario por completo, está seguro?
    </div>
</div>
{% endblock %}